﻿using System;
using Bbm.Persistence.Serializers;

namespace Bbm.Persistence
{
	public class CacheConfiguration
	{
		readonly ISerializationStrategy serializationStrategy;
		readonly IPhysicalStoreFactory storeFactory;
		readonly INameFactory nameFactory;

		public CacheConfiguration(ISerializationStrategy serializationStrategy, IPhysicalStoreFactory storeFactory, INameFactory nameFactory)
		{
			if (serializationStrategy == null) 
				throw new ArgumentNullException("serializationStrategy");

			if (storeFactory == null) 
				throw new ArgumentNullException("storeFactory");

			this.serializationStrategy = serializationStrategy;
			this.nameFactory = nameFactory ?? new DefaultNameFactory();
			this.storeFactory = storeFactory;
		}

		public INameFactory NameFactory
		{
			get { return nameFactory; }
		}

		public IPhysicalStoreFactory StoreFactory
		{
			get { return storeFactory; }
		}

		public ISerializationStrategy SerializationStrategy
		{
			get { return serializationStrategy; }
		}
	}
}